package main.rabbitmqProvider.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/rabbitmqProvider")
@ResponseBody
public class RabbitmqProviderController {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("/basicQueue")
    public String basicQueue() {
        System.out.println("basicQueue 执行了");
        rabbitTemplate.convertAndSend("basicQueue", "hello,world!");
        return "basicQueue";
    }
}
